package helper.scxml.scxml2.t0.case1_cycle

import helper.base.StringHelper.removeEmptyLine
import helper.base.string.ToStrHelper.IToStr
import helper.base.string.ToStrHelper.TabStringUnit.Companion.makeTabStringUnit
import helper.base.string.ToStrHelper.toSBStr
import helper.scxml.scxml2.t0.case1_cycle.LearningArgHelper.HyperArgUnit.Companion.getHyperArgUnit

object LearningArgHelper {
    class HyperArgUnit(
        val maxRuns: Int = 0,
        val maxGood: Int = 0,
        val maxBest: Int = 0,
        val evalRuns: Int = 0,
        val maxNoBetter: Int = 0,
        val maxIterations: Int = 0,
        val maxResets: Int = 0,
    ) : IToStr {
        companion object {
            fun getHyperArgUnit(
                maxRuns: Int = 0,
                maxGood: Int = 0,
                maxBest: Int = 0,
                evalRuns: Int = 0,
                maxNoBetter: Int = 0,
                maxIterations: Int = 0,
                maxResets: Int = 0
            ): HyperArgUnit {
                return HyperArgUnit(
                    maxRuns,
                    maxGood,
                    maxBest,
                    evalRuns,
                    maxNoBetter,
                    maxIterations,
                    maxResets,
                )
            }


            fun getType1HyperArgUnit(
            ): HyperArgUnit {
                return getHyperArgUnit(
                    maxRuns = 100,
                    maxGood = 10,
                    maxBest = 100,
                    evalRuns = 10,
                    maxNoBetter = 40,
                    maxIterations = Int.MAX_VALUE,
                    maxResets = 100,
                )
            }

            fun getDebugHyperArgUnit(
            ): HyperArgUnit {
                return getHyperArgUnit(
                    maxRuns = 2,
                    maxGood = 2,
                    maxBest = 2,
                    evalRuns = 2,
                    maxNoBetter = 2,
                    maxIterations = 2,
                    maxResets = 2,
                )
            }
        }

        override fun toStr(tabNum: Int): String {
            val sb = StringBuilder()
            val tsu = makeTabStringUnit(tabNum)
            sb.append("${tsu.tabNumStr0}InstanceClass(\n")
            maxRuns.toSBStr(sb, tsu, "maxRuns", 1)
            maxGood.toSBStr(sb, tsu, "maxGood", 1)
            maxBest.toSBStr(sb, tsu, "maxBest", 1)
            evalRuns.toSBStr(sb, tsu, "evalRuns", 1)
            maxNoBetter.toSBStr(sb, tsu, "maxNoBetter", 1)
            maxIterations.toSBStr(sb, tsu, "maxIterations", 1)
            maxResets.toSBStr(sb, tsu, "maxResets", 1)
            sb.append("${tsu.tabNumStr0})\n")
            return sb.toString().removeEmptyLine()
        }
    }

    @JvmStatic
    fun main(args: Array<String>) {
        println(getHyperArgUnit().toStr0())
    }
}